package com.fkcai.hansoul.controller;

import com.fkcai.hansoul.common.util.Result;
import com.fkcai.hansoul.model.dto.post.PostCategoryOneDto;
import com.fkcai.hansoul.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/category")
public class CategoryController {
	@Autowired
	private CategoryService categoryService;
	
	/**
	 * 获取所有帖子分类
	 *
	 * @return 所有帖子分类数据
	 */
	@GetMapping("/postCategories")
	public Result<List> getAllPostCategoriesTwo () {
		List<PostCategoryOneDto> categories = categoryService.getAllCategoriesOne();
		
		return Result.success(categories);
	}
}
